﻿using System.Windows.Shapes;
using System.Windows;
using System.Windows.Media;
using System.Windows.Input;
using System.Collections.Generic;

namespace WPFTurnBasedStrategyGame
{    
    public class Piece : Shape
    {
        private Rect r;
        private RectangleGeometry rg;
        private string id;
        private GameTeam team;
        private int x;
        private int y;
        private List<Piece> needsCombatResolution;
        private Forces force;

        public GameTeam Team
        {
            get 
            { 
                return team; 
            }
            set 
            { 
                team = value;

                if (team == GameTeam.Red)
                {
                    Fill = Brushes.Pink;
                }
                else
                {
                    Fill = Brushes.Cyan;
                }
            }
        }

        public string ID
        {
            get { return id; }
            set { id = value; }
        }

        public Piece()
            : base()
        {
            Point p = new Point(0, 0);
            Size s = new Size(20, 20);
            r = new Rect(p, s);
            rg = new RectangleGeometry(r);
            Stroke = Brushes.Pink;
            StrokeThickness = 2;            

            this.MouseLeftButtonDown += new MouseButtonEventHandler(Piece_MouseLeftButtonDown);
        }

        void Piece_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            //e.Handled = false;
        }

        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
        }

        protected override Geometry DefiningGeometry
        {
            get { return rg; }
        }

        public int X
        {
            get
            {
                return x;
            }
            set
            {
                x = value;
            }
        }

        public int Y
        {
            get
            {
                return y;
            }
            set
            {
                y = value;
            }
        }

        public List<Piece> NeedsCombatResolution
        {
            get
            {
                return needsCombatResolution;
            }
            set
            {
                needsCombatResolution = value;
            }
        }

        public Forces Force
        {
            get
            {
                return force;
            }
            set
            {
                force = value;
            }
        }

    }
}
